package com.android.recorder01;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class EnterActivity extends Activity {
	TextView text;
	EditText nameEdit;
	Button okBtn;
	Button cancelBtn;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.enter_layout);
		
		text = (TextView) findViewById(R.id.name_text);
		nameEdit = (EditText) findViewById(R.id.name_edit);
		
		okBtn = (Button)findViewById(R.id.ok_btn);
		okBtn.setOnClickListener(new OnClickListener() {			
			@Override
			public void onClick(View arg0) {
				Intent intent = new Intent(EnterActivity.this, RecorderActivity.class);
				intent.putExtra("filename", nameEdit.getText().toString());
				startActivity(intent);
				finish();
			}
		});
		
		cancelBtn = (Button)findViewById(R.id.cancel_btn);
		cancelBtn.setOnClickListener(new OnClickListener() {			
			@Override
			public void onClick(View arg0) {
				finish();
			}
		});
	}
}
